package com.jgy.event;


import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author 姜光远
 * @date 2023/6/30 17:20
 */
@Component
public class EventListener {


    @org.springframework.context.event.EventListener(PublishEventVo.class)
    @Async
    public void onEvent(PublishEventVo event) throws InterruptedException {
        System.out.println("目标方法执行，使用的参数是名为：" + event.getEventName() + "的参数，参数倒是名为：" + event.getEventDescription() + "的参数");
        System.out.println("目标方法执行，使用的参数是名为：" + event.getEventId() + "的参数，参数倒是名为：" + event.getEventName() + "的参数");
        System.out.println("目标方法执行，使用的参数是名为：" + event.getEventStartTime() + "的参数，参数倒是名为：" + event.getEventEndTime() + "的参数");
        System.out.println("目标方法执行，使用的参数是名为：" + event.getEventLocation() + "的参数，参数倒是名为：" + event.getEventImage() + "的参数");
        System.out.println("开始睡眠");
        Thread.sleep(3000);
        System.out.println("3秒睡眠结束");
    }



}
